package com.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.dao.TopicDao;
import com.model.Topic;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class SearchAction extends ActionSupport{

	public String searchTopics()
	{
		
		HttpServletRequest request=ServletActionContext.getRequest();
		String keyword=request.getParameter("keyword");
		System.out.println("keyword:"+keyword);
		TopicDao dao =new TopicDao();
		List<Topic> list=dao.searchTopics(keyword);
		
		ActionContext context=ActionContext.getContext();
		context.put("list", list);
		return "searchSuccess";
	}
}
